package de.baumann.browser.adapter;

import android.annotation.SuppressLint;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.math.BigDecimal;

import de.baumann.browser.R;
import de.baumann.browser.api.net.vo.HashValue;

/**
 * @author:
 * @date:2019/1/4 16:50
 * @discription: 算力获取记录适配器
 */
public class HashRecordAdapter extends BaseQuickAdapter<HashValue, BaseViewHolder> {

    public HashRecordAdapter(int layoutResId) {
        super(layoutResId);
    }

    @SuppressLint("SetTextI18n")
    @Override
    protected void convert(BaseViewHolder helper, HashValue item) {
        TextView tvRecordName = helper.getView(R.id.tvRecordName);
        TextView tvRecordTime = helper.getView(R.id.tvRecordTime);
        TextView tvRecordValue = helper.getView(R.id.tvRecordValue);

        tvRecordName.setText(item.getRemark());
        tvRecordTime.setText(item.getCreateTime());
        BigDecimal bigDecimal = new BigDecimal(item.getPower());

        tvRecordValue.setText("+" + bigDecimal.setScale(4,BigDecimal.ROUND_HALF_UP));
    }
}
